// api.js
import {
	request
} from '@/utils/request.js'; // 引入封装好的request.js
//获取省市区
// export const getCity = (data) => {
// 	return request({
// 		url: '/city/getPage',
// 		method: 'POST',
// 		data: data,
// 	});
// };
// 获取省
export const getProvincial = (data) => {
	return request({
		url: '/at_provincial_level/getPage',
		method: 'POST',
		data: data,
	});
};
// 获取市
export const getCity = (data) => {
	return request({
		url: '/city/getPage',
		method: 'POST',
		data: data,
	});
};
// 获取区
export const getDistrict = (data) => {
	return request({
		url: '/district/getPage',
		method: 'POST',
		data: data,
	});
};
//获取地址信息列表
export const getAddressList = (data) => {
	return request({
		url: '/shipping_address/getPage',
		method: 'POST',
		data: data,
	});
};
export const getAddressID = (id) => {
	return request({
		url: `/shipping_address/getById/${id}`, // 使用模板字符串并正确插入 id
		method: 'GET',
	});
};

//新增地址
export const addAddress = (data) => {
	return request({
		url: '/shipping_address/save',
		method: 'POST',
		data: data,
	});
};
//修改地址
export const editAddress = (data) => {
	return request({
		url: '/shipping_address/updateById',
		method: 'POST',
		data: data,
	});
};
//删除地址
export const delAddress = (data) => {
	return request({
		url: '/shipping_address/removeByCondition',
		method: 'POST',
		data: data,
	});
};